package com.renwei.yunlong.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import com.renwei.yunlong.R;
import com.zyf.fwms.commonlibrary.utils.AutoUtils;

/**
 * 对象详情  附件 --adapter
 *
 * Created by Administrator on 2017/9/6.
 */

public class NewDetailsAnnexAdapter extends RecyclerView.Adapter<NewDetailsAnnexAdapter.NewDetailsAnnexViewHolder>{

    private LayoutInflater inflater;
    private Context context;
    private String[] title = {"IMG20170222.JPEG","IMG20170222.JPEG"};

    private NewDetailsRelateOnClickListener onClickListener;

    public NewDetailsAnnexAdapter(Context context){
        this.context = context;
        //this.onClickListener = onClickListener;
        inflater = LayoutInflater.from(context);
    }

    @Override
    public NewDetailsAnnexViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

        View view =  inflater.inflate(R.layout.item_new_details_annex,null);
        AutoUtils.auto(view);
        return new NewDetailsAnnexAdapter.NewDetailsAnnexViewHolder(view);
    }

    @Override
    public void onBindViewHolder(NewDetailsAnnexViewHolder holder, int position) {
        holder.tvName.setText(title[position]);
        holder.tvSize.setText("386KB");
//        holder.itemView.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//
//            }
//        });
    }

    @Override
    public int getItemCount() {
        return title.length;
    }

    public interface NewDetailsRelateOnClickListener{
        void setOnClickListener();
    }

    static class NewDetailsAnnexViewHolder extends RecyclerView.ViewHolder{
        private View itemView;
        private TextView tvName;//图片名称
        private TextView tvSize;//图片大小

        public NewDetailsAnnexViewHolder(View view) {
            super(view);
            itemView = view;
            tvName = (TextView) itemView.findViewById(R.id.tv_name);
            tvSize = (TextView) itemView.findViewById(R.id.tv_size);
        }
    }

}
